//Pin connected to ST_CP of 74HC595
int latchPin = 8;
//Pin connected to SH_CP of 74HC595
int clockPin = 12;
////Pin connected to DS of 74HC595

int dataPin = 11;

int COM1 = 7;
int COM2 = 6;



void setup() {
  Serial.begin(9600);
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
  pinMode(COM1, OUTPUT);
  pinMode(COM2, OUTPUT);
}

int x; //Byte
int n; //Number of available bytes
void show(int mo, byte value1, byte value2)
{
    digitalWrite(mo, HIGH);
    digitalWrite(latchPin, LOW);
    //byte reg1 = lowByte(value1);
    //byte reg2 = lowByte(value2);
    shiftOut(dataPin, clockPin, MSBFIRST, value1);   // dig 2
    shiftOut(dataPin, clockPin, MSBFIRST, value2);   // dig 1
    digitalWrite(latchPin, HIGH);
    delay(10);
    digitalWrite(mo, LOW);  
}

void loop() 
{

   //show(COM1,5,6);
   //show(COM2,15,14);
   show(COM1,3,6);
   show(COM2,14,7);   
   //show(COM1,0,6);
   //show(COM2,0,14);

}
